﻿using PLCS.App.Shared.ViewModels;
using PLCS.Application.Contracts.EquipmentApp.Dtos;
using PLCS.Application.Contracts.StationApp.Dtos;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PLCS.App.ViewModels.Dialogs
{
    public class EquipmentInfoViewModel : HostDialogViewModel
    {
        private EquipmentDto model;

        public EquipmentDto Model
        {
            get { return model; }
            set { SetProperty(ref model, value); }
        }

        private StationDto station;

        public StationDto Station
        {
            get { return station; }
            set { SetProperty(ref station, value); }
        }

        public override void OnDialogOpened(IDialogParameters parameters)
        {
            if (parameters.ContainsKey("Value"))
            {
                Model = parameters.GetValue<EquipmentDto>("Value");
                Station = parameters.GetValue<StationDto>("Station");
                Title = "编辑";
            }
            else
            {
                Title = "新增";
                Model = new EquipmentDto();
            }
        }
    }
}